from pydantic import BaseModel, Field
from typing import Optional


class SurveyData(BaseModel):
    """Fried衰弱评估问卷数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: str
    recorderPosition: str
    recorderInstitution: str
    recorderContact: str
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    height: Optional[float] = None
    weight: Optional[float] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None
    weightLoss: int
    walkTime: float
    gripStrength: float
    physicalActivity: float
    fatigue1: int
    fatigue2: int
    totalScore: int
    diagnosis: str
    createdAt: str


class FileData(BaseModel):
    """文件数据模型"""

    filename: str
    content: str
    surveyId: str


class ExportRequest(BaseModel):
    """导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict
    surveyType: Optional[str] = None  # 问卷类型，如 'psqi', 'survey' 等


class RockwoodSurveyData(BaseModel):
    """Rockwood CFS问卷数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    height: Optional[float] = None
    weight: Optional[float] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None
    cfsScore: Optional[int] = None  # CFS评分 1-9
    functionalAssessment: Optional[str] = None  # 功能状态评估
    mobilityLevel: Optional[str] = None  # 活动能力评估
    level: Optional[str] = None  # 衰弱等级名称
    category: Optional[str] = None  # 分类（健壮、易损、衰弱等）
    description: Optional[str] = None  # 等级描述
    recommendations: Optional[list] = None  # 建议措施
    createdAt: Optional[str] = None


class RockwoodExportRequest(BaseModel):
    """Rockwood CFS导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict


class GPMSurveyData(BaseModel):
    """老年疼痛量表(GPM)问卷数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    height: Optional[float] = None
    weight: Optional[float] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None

    # 维度一：疼痛强度和频率
    restPain: Optional[int] = None  # 静息时疼痛程度 (0-4)
    activityPain: Optional[int] = None  # 活动时疼痛程度 (0-4)
    painFrequency: Optional[int] = None  # 疼痛发作频率 (0-4)
    nightWakeups: Optional[int] = None  # 夜间痛醒次数 (0-4)
    painDuration: Optional[int] = None  # 疼痛持续时间 (0-4)

    # 维度二：日常生活活动能力
    dressingAbility: Optional[int] = None  # 穿衣能力 (0-4)
    eatingAbility: Optional[int] = None  # 进食能力 (0-4)
    walkingAbility: Optional[int] = None  # 行走能力 (0-4)
    toiletingAbility: Optional[int] = None  # 如厕能力 (0-4)
    hygieneAbility: Optional[int] = None  # 洗漱能力 (0-4)
    sleepQuality: Optional[int] = None  # 睡眠质量 (0-4)
    houseworkAbility: Optional[int] = None  # 家务活动 (0-4)

    # 维度三：心理情绪状态
    anxiety: Optional[int] = None  # 焦虑情绪 (0-4)
    depression: Optional[int] = None  # 抑郁情绪 (0-4)
    irritability: Optional[int] = None  # 易怒倾向 (0-4)
    helplessness: Optional[int] = None  # 无助感 (0-4)
    concentration: Optional[int] = None  # 注意力集中 (0-4)
    lifeEnjoyment: Optional[int] = None  # 生活乐趣 (0-4)

    # 维度四：社会功能
    socialParticipation: Optional[int] = None  # 社交活动参与 (0-4)
    familyRole: Optional[int] = None  # 家庭角色履行 (0-4)
    workAbility: Optional[int] = None  # 工作能力 (0-4)
    intimateRelationship: Optional[int] = None  # 亲密关系 (0-4)

    # 维度五：疼痛管理
    painReliefEffect: Optional[int] = None  # 疼痛缓解措施效果 (0-4)
    medicalSeeking: Optional[int] = None  # 就医主动性 (0-4)

    # 维度六：主观描述
    painDescription: Optional[str] = None  # 疼痛自我描述
    priorityImprovement: Optional[str] = None  # 优先改善需求

    # 计算字段
    dimension1Score: Optional[int] = None  # 维度一总分 (0-20)
    dimension2Score: Optional[int] = None  # 维度二总分 (0-28)
    dimension3Score: Optional[int] = None  # 维度三总分 (0-24)
    dimension4Score: Optional[int] = None  # 维度四总分 (0-16)
    dimension5Score: Optional[int] = None  # 维度五总分 (0-8)
    totalScore: Optional[int] = None  # 总分 (0-96)
    painLevel: Optional[str] = None  # 疼痛等级 (轻度/中度/重度/极重度)
    recommendations: Optional[list] = None  # 建议措施
    createdAt: Optional[str] = None


class GPMExportRequest(BaseModel):
    """GPM问卷导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict


class NRSSurveyData(BaseModel):
    """NRS疼痛评估量表数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    diagnosis: Optional[str] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None

    # NRS疼痛评估项目 (0-10分)
    currentPain: Optional[int] = None  # 当前疼痛程度
    worstPain24h: Optional[int] = None  # 24小时内最严重疼痛
    leastPain24h: Optional[int] = None  # 24小时内最轻微疼痛
    averagePain24h: Optional[int] = None  # 24小时内平均疼痛
    restPain: Optional[int] = None  # 静息时疼痛程度
    activityPain: Optional[int] = None  # 活动时疼痛程度
    functionalImpact: Optional[int] = None  # 疼痛对功能的影响程度

    # 疼痛特征
    painLocation: Optional[str] = None  # 疼痛部位
    painCharacter: Optional[list] = None  # 疼痛性质
    painDuration: Optional[str] = None  # 疼痛持续时间
    painTriggers: Optional[str] = None  # 诱发因素
    painRelief: Optional[str] = None  # 缓解因素

    # 计算结果
    maxPainScore: Optional[int] = None  # 最高疼痛评分
    painLevel: Optional[str] = None  # 疼痛等级 (轻度/中度/重度)
    painLevelRange: Optional[str] = None  # 疼痛等级范围
    recommendations: Optional[list] = None  # 建议措施
    createdAt: Optional[str] = None


class NRSExportRequest(BaseModel):
    """NRS疼痛评估导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict


class PSQISurveyData(BaseModel):
    """匹兹堡睡眠质量指数(PSQI)问卷数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None
    assessmentDate: Optional[str] = None

    # 原始问卷字段 - 用于CSV生成
    SL01: Optional[str] = None  # 上床时间
    SL02: Optional[int] = None  # 入睡时间(分钟)
    SL03: Optional[str] = None  # 起床时间
    SL04: Optional[float] = None  # 实际睡眠时间(小时)
    SL051: Optional[int] = None  # 入睡困难
    SL052: Optional[int] = None  # 夜间易醒或早醒
    SL053: Optional[int] = None  # 起床上洗手间
    SL054: Optional[int] = None  # 呼吸不畅
    SL055: Optional[int] = None  # 鼾声或咳嗽
    SL056: Optional[int] = None  # 感到太冷
    SL057: Optional[int] = None  # 感到太热
    SL058: Optional[int] = None  # 做恶梦
    SL059: Optional[int] = None  # 身上疼痛不适
    SL05X: Optional[str] = None  # 其他干扰问题描述
    SL05X1: Optional[int] = None  # 其他干扰频率
    SL06: Optional[int] = None  # 睡眠质量评价
    SL07: Optional[int] = None  # 服用睡眠药物频率
    SL08: Optional[int] = None  # 日间困倦
    SL09: Optional[int] = None  # 精力不足
    SL10: Optional[int] = None  # 睡眠伙伴状况
    SL101: Optional[int] = None  # 伙伴观察：打鼾
    SL102: Optional[int] = None  # 伙伴观察：呼吸暂停
    SL103: Optional[int] = None  # 伙伴观察：腿部抽动
    SL104: Optional[int] = None  # 伙伴观察：意识模糊
    SL10X: Optional[str] = None  # 伙伴观察：其他问题描述
    SL105: Optional[int] = None  # 伙伴观察：其他问题频率

    # 计算结果字段
    totalScore: Optional[int] = None  # PSQI总分
    maxScore: Optional[int] = None  # 最高分
    subjective_sleep_quality: Optional[int] = None
    sleep_latency: Optional[int] = None
    sleep_duration: Optional[int] = None
    sleep_efficiency: Optional[int] = None
    sleep_disturbance: Optional[int] = None
    sleep_medication: Optional[int] = None
    daytime_dysfunction: Optional[int] = None
    diagnosis: Optional[str] = None
    createdAt: Optional[str] = None


class PSQIExportRequest(BaseModel):
    """PSQI睡眠质量评估导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict


class HAMDSurveyData(BaseModel):
    """汉密尔顿抑郁量表(HAMD)问卷数据模型"""

    surveyType: str = "HAMD"
    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None

    # HAMD 17个评估项目
    depression: Optional[int] = None  # 抑郁情绪 (0-4)
    guilt: Optional[int] = None  # 有罪感 (0-4)
    suicide: Optional[int] = None  # 自杀 (0-4)
    insomnia_early: Optional[int] = None  # 入睡困难 (0-2)
    insomnia_middle: Optional[int] = None  # 睡眠不深 (0-2)
    insomnia_late: Optional[int] = None  # 早醒 (0-2)
    work_interests: Optional[int] = None  # 工作和兴趣 (0-4)
    retardation: Optional[int] = None  # 迟滞 (0-4)
    agitation: Optional[int] = None  # 激越 (0-4)
    anxiety_psychic: Optional[int] = None  # 精神性焦虑 (0-4)
    anxiety_somatic: Optional[int] = None  # 躯体性焦虑 (0-4)
    somatic_gastrointestinal: Optional[int] = None  # 胃肠道症状 (0-2)
    somatic_general: Optional[int] = None  # 全身症状 (0-2)
    genital_symptoms: Optional[int] = None  # 生殖器症状 (0-2)
    hypochondriasis: Optional[int] = None  # 疑病 (0-4)
    loss_of_weight: Optional[int] = None  # 体重减轻 (0-2)
    insight: Optional[int] = None  # 自知力 (0-2)

    # 评估结果
    totalScore: Optional[int] = None  # 总分 (0-52)
    maxTotalScore: Optional[int] = None  # 最高总分
    diagnosis: Optional[str] = None  # 诊断结果
    severity: Optional[str] = None  # 严重程度
    riskLevel: Optional[str] = None  # 风险等级
    suicideRisk: Optional[bool] = None  # 自杀风险
    createdAt: Optional[str] = None


class HAMDExportRequest(BaseModel):
    """HAMD导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict


class OralSurveyData(BaseModel):
    """口腔检查表数据模型"""

    surveyId: str
    examDate: Optional[str] = None
    examinerName: Optional[str] = None
    examinerPosition: Optional[str] = None
    examinerInstitution: Optional[str] = None
    examinerContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    patientId: Optional[str] = None
    birthplace: Optional[str] = None  # 籍贯
    phone: Optional[str] = None
    remarks: Optional[str] = None

    # 牙齿状况检查
    cariesPresent: Optional[bool] = None  # 是否有龋齿
    cariesDetails: Optional[str] = None  # 龋齿详细情况
    cariesSeverity: Optional[str] = None  # 龋坏程度

    defectPresent: Optional[bool] = None  # 是否有牙齿缺损
    defectCause: Optional[str] = None  # 缺损原因
    defectDetails: Optional[str] = None  # 缺损详细情况

    missingPresent: Optional[bool] = None  # 是否有牙齿缺失
    missingPositions: Optional[str] = None  # 缺失牙位
    missingDuration: Optional[str] = None  # 缺失时间

    # 牙周情况检查
    gingivalColor: Optional[str] = None  # 牙龈颜色
    gingivalTexture: Optional[str] = None  # 牙龈质地
    gingivalBleeding: Optional[str] = None  # 牙龈出血情况
    gingivalAbnormalDesc: Optional[str] = None  # 牙龈异常描述

    pocketDepthNormal: Optional[bool] = None  # 牙周袋深度是否正常
    pocketDepthDetails: Optional[str] = None  # 异常牙周袋深度记录
    pocketDepthMax: Optional[float] = None  # 最大牙周袋深度

    boneResorption: Optional[str] = None  # 牙槽骨吸收程度
    boneResorptionSites: Optional[str] = None  # 吸收部位

    # 口腔黏膜检查
    mucosaNormal: Optional[bool] = None  # 口腔黏膜是否正常
    mucosaLesionType: Optional[str] = None  # 黏膜病变类型
    mucosaLesionDetails: Optional[str] = None  # 病变详细描述

    # 颌面外科检查
    facialSymmetryNormal: Optional[bool] = None  # 面部对称性是否正常
    asymmetryDescription: Optional[str] = None  # 不对称情况描述

    tmjClicking: Optional[str] = None  # 关节弹响
    tmjPain: Optional[str] = None  # 关节疼痛
    mouthOpening: Optional[float] = None  # 最大开口度(mm)
    tmjOtherSymptoms: Optional[str] = None  # 其他异常表现

    # 评估结果
    overallStatus: Optional[str] = None  # 总体健康状况
    riskLevel: Optional[str] = None  # 风险等级
    summary: Optional[str] = None  # 检查总结

    createdAt: Optional[str] = None


class OralExportRequest(BaseModel):
    """口腔检查表导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )


class OHIP14SurveyData(BaseModel):
    """口腔健康影响程度量表(OHIP-14)问卷数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    age: int = 0
    gender: Optional[str] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None

    # 原始问卷字段（14个问题，每个问题0-4分）
    Q01: Optional[int] = None  # 是否曾因为口腔的问题而影响发音
    Q02: Optional[int] = None  # 是否因为口腔的问题而感到自己的味觉变差
    Q03: Optional[int] = None  # 口腔内是否曾出现过明显疼痛
    Q04: Optional[int] = None  # 是否曾因为口腔的问题而觉得吃什么东西都不舒服
    Q05: Optional[int] = None  # 是否曾因为口腔的问题而在其他人面前觉得不自在
    Q06: Optional[int] = None  # 是否曾因为口腔的问题而感到紧张不安
    Q07: Optional[int] = None  # 是否曾因为口腔的问题而对自己的饮食很不满意
    Q08: Optional[int] = None  # 是否曾因为口腔的问题而不得不在进餐时中途停下来
    Q09: Optional[int] = None  # 是否曾因为口腔的问题而感到难以休息
    Q10: Optional[int] = None  # 是否曾因为口腔的问题而感到尴尬
    Q11: Optional[int] = None  # 是否曾因为口腔的问题而变得容易对其他人发脾气
    Q12: Optional[int] = None  # 是否曾因为口腔的问题而难以完成日常工作
    Q13: Optional[int] = None  # 是否曾因为口腔的问题而觉得生活不令人满意
    Q14: Optional[int] = None  # 是否曾因为口腔的问题而什么事都干不了

    # 评估结果
    totalScore: Optional[int] = None  # 总分 (0-56)
    maxScore: Optional[int] = None  # 最高分
    diagnosis: Optional[str] = None  # 诊断结果
    createdAt: Optional[str] = None


class OHIP14ExportRequest(BaseModel):
    """OHIP-14问卷导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )


class BatchExportRequest(BaseModel):
    """批量导出请求模型"""

    surveyIds: list[str]  # 编号列表
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )


class PersonalInfoSurveyData(BaseModel):
    """个人信息登记表数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    # 基本信息
    patientName: Optional[str] = "未填写"
    idCard: Optional[str] = None
    age: int = 0
    gender: Optional[str] = None
    birthDate: Optional[str] = None
    phone: Optional[str] = None
    email: Optional[str] = None
    address: Optional[str] = None
    # 社会信息
    maritalStatus: Optional[str] = None
    education: Optional[str] = None
    occupation: Optional[str] = None
    retired: Optional[str] = None
    # 健康信息
    height: Optional[float] = None
    weight: Optional[float] = None
    bloodType: Optional[str] = None
    allergies: Optional[str] = None
    medicalHistory: Optional[str] = None
    currentMedications: Optional[str] = None
    # 紧急联系人
    emergencyContactName: Optional[str] = None
    emergencyContactRelation: Optional[str] = None
    emergencyContactPhone: Optional[str] = None
    # 备注
    remarks: Optional[str] = None
    # 计算结果
    completeness: Optional[dict] = None
    bmi: Optional[dict] = None
    dataQuality: Optional[dict] = None
    createdAt: Optional[str] = None


class PersonalInfoExportRequest(BaseModel):
    """个人信息登记表导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )


class CognitiveSurveyData(BaseModel):
    """认知能力记录表数据模型 - 根据T 3.2.1认知能力记录表设计"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    patientId: Optional[str] = None  # 编号
    age: int = 0
    gender: Optional[str] = None
    education: Optional[str] = None
    phone: Optional[str] = None
    measurementLocation: Optional[str] = None  # 测量地点
    measurementPerson: Optional[str] = None  # 测量人员
    remarks: Optional[str] = None

    # 1. 注意 (0-5分)
    attentionWord1: Optional[str] = None  # 鼻子 (remembered/forgotten)
    attentionWord2: Optional[str] = None  # 丝绸 (remembered/forgotten)
    attentionWord3: Optional[str] = None  # 寺庙 (remembered/forgotten)
    attentionWord4: Optional[str] = None  # 菊花 (remembered/forgotten)
    attentionWord5: Optional[str] = None  # 红色 (remembered/forgotten)
    attentionScore: Optional[int] = None  # 注意得分

    # 2. 执行功能/言语
    animalNamesCount: Optional[int] = None  # 正确回答的动物名字个数
    animalNamesList: Optional[str] = None  # 说出的动物名字列表

    # 3. 定向 (0-6分)
    orientationYear: Optional[int] = None  # 年
    orientationMonth: Optional[int] = None  # 月
    orientationDay: Optional[int] = None  # 日
    orientationWeekday: Optional[str] = None  # 星期几
    orientationLocation: Optional[str] = None  # 地点
    orientationCity: Optional[str] = None  # 城市
    orientationScore: Optional[int] = None  # 定向得分

    # 4. 记忆 (0-15分，三种方式各5分)
    memoryNoHint: Optional[str] = None  # 无提示回忆
    memoryNoHintScore: Optional[int] = None  # 无提示回忆得分
    memoryCategoryHint: Optional[str] = None  # 分类提示回忆
    memoryCategoryHintScore: Optional[int] = None  # 分类提示回忆得分
    memoryMultipleChoice: Optional[str] = None  # 多选提示回忆
    memoryMultipleChoiceScore: Optional[int] = None  # 多选提示回忆得分

    # 5. 计算能力
    calculationQuestion1: Optional[str] = None  # 计算题目1
    calculationAnswer1: Optional[str] = None  # 答案1
    calculationQuestion2: Optional[str] = None  # 计算题目2
    calculationAnswer2: Optional[str] = None  # 答案2
    calculationQuestion3: Optional[str] = None  # 计算题目3
    calculationAnswer3: Optional[str] = None  # 答案3
    calculationScore: Optional[int] = None  # 计算能力得分

    # 评估结果
    totalScore: Optional[int] = None  # 总分
    maxScore: Optional[int] = None  # 最高分
    percentage: Optional[float] = None  # 百分比
    cognitiveLevel: Optional[str] = None  # 认知功能水平代码
    cognitiveLevelName: Optional[str] = None  # 认知功能水平名称
    diagnosis: Optional[str] = None  # 诊断结果
    recommendations: Optional[list] = None  # 建议措施
    dimensions: Optional[dict] = None  # 各维度得分详情
    createdAt: Optional[str] = None


class CognitiveExportRequest(BaseModel):
    """认知能力评估导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )


class PersonalitySurveyData(BaseModel):
    """性格特征记录表数据模型 - 根据T 3.3.1性格特征记录表设计"""

    surveyId: str
    recordTime: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    patientId: Optional[str] = None  # 编号
    age: int = 0
    gender: Optional[str] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None

    # 性格特征问题（第一部分，7级评分：1-7）
    PT01: Optional[int] = None  # 外向的，热情的
    PT02: Optional[int] = None  # 爱挑剔，好争论
    PT03: Optional[int] = None  # 可靠的，自律的
    PT04: Optional[int] = None  # 焦虑，易心烦的
    PT05: Optional[int] = None  # 容易接纳新事物，能容忍复杂事物的
    PT06: Optional[int] = None  # 保守的，安静的
    PT07: Optional[int] = None  # 有同情心，热心的
    PT08: Optional[int] = None  # 条理不清，粗心的
    PT09: Optional[int] = None  # 平静，情绪稳定的
    PT10: Optional[int] = None  # 传统，枯燥的

    # 精神状态问题（第二部分，4级评分：0-3）
    MS01: Optional[int] = None  # 我觉得很难让自己放松安静下来
    MS02: Optional[int] = None  # 我感到口干舌燥
    MS03: Optional[int] = None  # 我好像不再有快乐的感觉
    MS04: Optional[int] = None  # 我感到呼吸困难（气喘或透不过气来）
    MS05: Optional[int] = None  # 我感到很难主动开始学习或工作
    MS06: Optional[int] = None  # 我对事情过于敏感，或反应过度
    MS07: Optional[int] = None  # 我感到颤抖（例如手抖）
    MS08: Optional[int] = None  # 我觉得自己消耗很多精力
    MS09: Optional[int] = None  # 我担心一些场合自己会恐慌或出丑
    MS10: Optional[int] = None  # 我觉得没有什么可期待盼望的事情
    MS11: Optional[int] = None  # 我感到忐忑不安
    MS12: Optional[int] = None  # 我感到很难放松自己
    MS13: Optional[int] = None  # 我感到情绪低落，消沉沮丧
    MS14: Optional[int] = None  # 我无法容忍任何阻碍我继续工作的事情
    MS15: Optional[int] = None  # 我感到恐慌，精神或身体快要崩溃了
    MS16: Optional[int] = None  # 我对什么事情都没有热情，提不起兴趣
    MS17: Optional[int] = None  # 我觉得自己没有价值
    MS18: Optional[int] = None  # 我觉得自己很敏感，容易被触怒
    MS19: Optional[int] = None  # 没做什么体力活动时，我也感到心律不正常
    MS20: Optional[int] = None  # 我会无缘无故地感到害怕
    MS21: Optional[int] = None  # 我觉得生命毫无意义

    # 评估结果
    personalityScores: Optional[dict] = None  # 性格特征得分详情
    mentalStateScores: Optional[dict] = None  # 精神状态得分详情
    completeness: Optional[dict] = None  # 完整度信息
    createdAt: Optional[str] = None


class PersonalityExportRequest(BaseModel):
    """性格特征评估导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )


class OutdoorActivitySurveyData(BaseModel):
    """个体行为记录表（户外活动路线）数据模型 - 根据T 4.1.1个体行为记录表设计"""

    surveyId: str
    recordTime: Optional[str] = None
    recordDate: Optional[str] = None  # 记录日期
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    patientId: Optional[str] = None  # 编号
    residenceAddress: Optional[str] = None  # 居住地址
    age: int = 0
    gender: Optional[str] = None
    phone: Optional[str] = None
    remarks: Optional[str] = None

    # 活动记录列表（最多6条）
    activities: Optional[list] = None  # 活动记录数组

    # 评估结果
    totalActivities: Optional[int] = None  # 总活动数
    statistics: Optional[dict] = None  # 统计信息
    summary: Optional[dict] = None  # 评估摘要
    createdAt: Optional[str] = None


class OutdoorActivityExportRequest(BaseModel):
    """户外活动记录表导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )


class LeisureActivitySurveyData(BaseModel):
    """空闲活动频率量表数据模型"""

    surveyId: str
    recordTime: Optional[str] = None
    recordDate: Optional[str] = None
    recorderName: Optional[str] = None
    recorderPosition: Optional[str] = None
    recorderInstitution: Optional[str] = None
    recorderContact: Optional[str] = None
    patientName: Optional[str] = "未填写"
    patientId: Optional[str] = None
    age: int = 0
    gender: Optional[str] = None
    phone: Optional[str] = None
    measurementLocation: Optional[str] = None
    measurementPerson: Optional[str] = None
    remarks: Optional[str] = None

    # 活动频率数据（Q01-Q14）
    Q01: Optional[int] = None
    Q02: Optional[int] = None
    Q03: Optional[int] = None
    Q04: Optional[int] = None
    Q05: Optional[int] = None
    Q06: Optional[int] = None
    Q07: Optional[int] = None
    Q08: Optional[int] = None
    Q09: Optional[int] = None
    Q10: Optional[int] = None
    Q11: Optional[int] = None
    Q12: Optional[int] = None
    Q13: Optional[int] = None
    Q14: Optional[int] = None

    # 健身器材选择（最多3项）
    fitnessEquipment: Optional[list] = None

    # 评估结果
    totalScore: Optional[int] = None
    averageScore: Optional[float] = None
    answeredCount: Optional[int] = None
    frequencyDistribution: Optional[dict] = None
    participationLevel: Optional[dict] = None
    statistics: Optional[dict] = None
    createdAt: Optional[str] = None


class LeisureActivityExportRequest(BaseModel):
    """空闲活动频率量表导出请求模型"""

    surveyId: str
    password: str
    exportOptions: dict = Field(
        default_factory=lambda: {"includeRawData": True, "includeStatistics": True}
    )
